package com.example.service;

import com.example.event.EventPublisher;
import com.example.model.entity.user.User;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class SomeBusinessService {

    private final EventPublisher eventPublisher;

    public void doSomething() {
        User user = new User("John Doe");
        // 发布事件，通知用户模块处理
        eventPublisher.publishEvent("UserModule", user);
        eventPublisher.publishEvent("OrgModule", user);
    }

    public void doSomethingGeneric() {
        User user = new User("John Doe");
        eventPublisher.publishGenericEvent(user);
    }
}